package com.sapitest.script.goodslisttest.paracheck;

import com.sapitest.imp.TestCases;
import com.sapitest.imp.TestData;
import com.sapitest.keywords.asserts.BaseAssert;
import com.sapitest.keywords.asserts.JSONAssert;
import com.sapitest.utils.ConfigFile;
import com.sapitest.utils.bean.Response;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

/**
 * 接口/v1/goodslist参数pageindex校验
 */
public class PageindexTest {
    @BeforeClass
    public void beforeClass() {
    }

    @Test(description= "pageindex为-1")
    public void testcase001(){
        String exp = TestData.getExpResponseData(ConfigFile.getTestParameter("MY_SHOPPING_TROLLEY_TABLE"),32);
        Response response = TestCases.testMyShoppingTrolley(32);
        BaseAssert.numEquals(response.getResponseCode(), 200);
        JSONAssert.jsonObjectEquals(response.getResponseBody(), exp);
    }

    @Test(description= "pageindex为int最大值2147483647")
    public void testcase002(){
        String exp = TestData.getExpResponseData(ConfigFile.getTestParameter("MY_SHOPPING_TROLLEY_TABLE"),33);
        Response response = TestCases.testMyShoppingTrolley(33);
        BaseAssert.numEquals(response.getResponseCode(), 200);
        JSONAssert.jsonObjectEquals(response.getResponseBody(), exp);
    }

    @Test(description= "pageindex大于int最大值2147483647")
    public void testcase003(){
        String exp = TestData.getExpResponseData(ConfigFile.getTestParameter("MY_SHOPPING_TROLLEY_TABLE"),34);
        Response response = TestCases.testMyShoppingTrolley(34);
        BaseAssert.numEquals(response.getResponseCode(), 200);
        JSONAssert.jsonObjectEquals(response.getResponseBody(), exp);
    }

    @Test(description= "pageindex长度超过10")
    public void testcase004(){
        String exp = TestData.getExpResponseData(ConfigFile.getTestParameter("MY_SHOPPING_TROLLEY_TABLE"),35);
        Response response = TestCases.testMyShoppingTrolley(35);
        BaseAssert.numEquals(response.getResponseCode(), 200);
        JSONAssert.jsonObjectEquals(response.getResponseBody(), exp);
    }
}
